package com.lineage.server.serverpackets;

import com.lineage.server.model.Instance.L1DoorInstance;

public class S_Door extends ServerBasePacket {
  private byte[] _byte;
  
  public S_Door(L1DoorInstance door) {
    this._byte = null;
    buildPacket(door.getEntranceX(), door.getEntranceY(), door.getDirection(), door.getPassable());
  }
  
  public S_Door(int x, int y, int direction, int passable) {
    this._byte = null;
    buildPacket(x, y, direction, passable);
  }
  
  private void buildPacket(int x, int y, int direction, int passable) {
    writeC(209);
    writeH(x);
    writeH(y);
    writeC(direction);
    writeC(passable);
  }
  
  public byte[] getContent() {
    if (this._byte == null)
      this._byte = getBytes(); 
    return this._byte;
  }
  
  public String getType() {
    return getClass().getSimpleName();
  }
}
